Skip to content

Update github.com/docker/docker dependency to newer moby modules#883

Merged
mbevc1 merged 2 commits into
mainfrom
20260511_bump_docker
May 12, 2026
Merged

Update github.com/docker/docker dependency to newer moby modules#883
mbevc1 merged 2 commits into
mainfrom
20260511_bump_docker

Conversation

@mbevc1
Copy link
Copy Markdown
Contributor

@mbevc1 mbevc1 commented May 11, 2026

Replace direct dependency on github.com/docker/docker v28.5.2+incompatible with the redesigned github.com/moby/moby/client and github.com/moby/moby/api modules.

Adapts call sites to the new client API:

  • ContainerCreate now takes a single ContainerCreateOptions struct
  • ContainerStart/ContainerRemove/ImageTag return a result struct
  • ContainerList returns a ContainerListResult wrapping []container.Summary
  • Image/Container option types moved from api/types/{image,container} onto the client package (e.g. client.ImagePullOptions)

Move away from deprecated library: moby/moby#52404

Should also resolve security alerts: https://github.com/kosli-dev/cli/security/dependabot

Also minor updates to README.md

Replace direct dependency on `github.com/docker/docker v28.5.2+incompatible`
with the redesigned `github.com/moby/moby/client` and
`github.com/moby/moby/api` modules.

Adapts call sites to the new client API:
- ContainerCreate now takes a single ContainerCreateOptions struct
- ContainerStart/ContainerRemove/ImageTag return a result struct
- ContainerList returns a ContainerListResult wrapping []container.Summary
- Image/Container option types moved from api/types/{image,container}
  onto the client package (e.g. client.ImagePullOptions)
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 11, 2026

Claude finished @mbevc1's task in 3m 35s —— View job


PR Review: Update Docker dependency to moby modules

  • Phase 1: Static analysis (build, vet, mod tidy)
  • Phase 2: Code review of changed files
  • Phase 3: Post review feedback

Phase 1: Static Analysis

All three checks pass cleanly:

  • go build ./... — compiles successfully
  • go vet ./... — no issues found
  • go mod tidy — no diff, dependencies are consistent

Phase 2: Code Review

Overall: This is a clean, well-executed migration from the deprecated docker/docker package to the redesigned moby/moby/client and moby/moby/api modules. All call sites are updated consistently, the code compiles, and no stale docker/docker imports remain in the source.

One item to verify

API version negotiation (see inline comment): The old code explicitly called client.WithAPIVersionNegotiation() to prevent "client version too new" errors against older Docker daemons. The new client.New(client.FromEnv) drops this. Based on the moby/moby redesign, negotiation should now be the default — but it would be good to confirm this, since a regression here would silently break users on older Docker engines.

Minor observations

  • go.mod replace directive (inline): The indirect docker/docker v28.3.2 vs replace target moby/moby v28.5.2 version mismatch is functionally fine (replace wins), but could confuse future readers.
  • ContainerList.Items: The new ContainerListResult wrapper is correctly unwrapped via .Items in snapshotDocker.go:102.
  • Return value handling: ContainerStart, ContainerRemove, and ImageTag now return result structs — all correctly handled with _, err =.
  • No remaining old imports: Verified with grep — zero docker/docker imports remain in cmd/ or internal/.

Phase 3: What's done well

  • Consistent migration: All three client-creation sites (docker.go, snapshotDocker.go, digest.go) are updated identically to the new client.New(client.FromEnv) pattern.
  • Clean dependency graph: Unused transitive deps (moby/sys/sequential, morikuni/aec, Azure/go-ansiterm, etc.) are properly pruned from go.sum.
  • README improvements: The grammar fix, trailing whitespace cleanup, and added badges are nice touches bundled appropriately.
  • Minimal diff: The PR changes only what needs to change — no unnecessary refactoring.

@mbevc1 mbevc1 marked this pull request as ready for review May 11, 2026 17:09
@mbevc1 mbevc1 added dependencies Pull requests that update a dependency file go Pull requests that update go code labels May 11, 2026
@mbevc1 mbevc1 enabled auto-merge (squash) May 11, 2026 17:16
Comment thread go.mod
Comment thread internal/docker/docker.go
Comment thread internal/docker/docker.go
@mbevc1 mbevc1 merged commit c2d2453 into main May 12, 2026
20 checks passed
@mbevc1 mbevc1 deleted the 20260511_bump_docker branch May 12, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants